﻿'use strict';
QuotingToolApp.factory('myQuoteData', ['$resource','QUOTINGTOOL_CONFIG',
    function ($resource, QUOTINGTOOL_CONFIG) {
        var quoteDatasCollection = [];
        return {
            getRecentQuotes: function () {
                return $resource(QUOTINGTOOL_CONFIG.baseUrl + '/api/orcl/getquoterecent/').query();
            },

            getQuotes: function (searchParams) {
                var resource = $resource(QUOTINGTOOL_CONFIG.baseUrl + '/api/orcl/findquote/:quotenumber/:fromdate/:todate/:createdby/:updatedby/:sfdcaccountid/:soldtoid/:contractid',
                    {quotenumber:'@quotenumber'},{fromdate:'@fromdate'},{todate:'@todate'},{createdby:'@createdby'},{updatedby:'@updatedby'},{sfdcaccountid:'@sfdcaccountid'},{soldtoid:'@soldtoid'},{contractid:'@contractid'});

                
                return resource.query({
                    quotenumber: searchParams.Quotenumber,
                    fromdate: searchParams.Fromdate,
                    todate: searchParams.Todate,
                    createdby: searchParams.Createdby,
                    updatedby: searchParams.Updatedby,
                    sfdcaccountid: searchParams.Sfdcaccountid,
                    soldtoid: searchParams.Soldtoid,
                    contractid: searchParams.Contractid
                });                
        }

        };

    }]);